package com.hupu.jrs.injector.module

import android.content.Context
import com.hupu.jrs.api.forum.ForumApi
import com.hupu.jrs.api.game.GameApi
import com.hupu.jrs.api.login.CookieApi
import com.hupu.jrs.components.retrofit.RequestHelper
import com.hupu.jrs.components.storage.UserStorage
import javax.inject.Named
import javax.inject.Singleton
import dagger.Module
import dagger.Provides
import okhttp3.OkHttpClient

/**
 * Created by sll on 2015/3/7.
 */
@Module
class ApiModule {

    @Provides
    @Singleton
    fun provideHuPuApi(userStorage: UserStorage, @Named("api") okHttpClient: OkHttpClient,
                       requestHelper: RequestHelper, mContext: Context): ForumApi {
        return ForumApi(requestHelper, userStorage, okHttpClient, mContext)
    }

    @Provides
    @Singleton
    fun provideGameApi(requestHelper: RequestHelper,
                       @Named("api") okHttpClient: OkHttpClient): GameApi {
        return GameApi(requestHelper, okHttpClient)
    }

    @Provides
    @Singleton
    fun providesCookieApi(@Named("api") okHttpClient: OkHttpClient): CookieApi {
        return CookieApi(okHttpClient)
    }
}
